package com.weaver.qfengx;

import org.apache.commons.codec.binary.Base64;
import org.junit.Test;

import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;

/**
 * 加解密工具类
 *
 * @Author Qfeng
 * @Date 2020-01-10 22:18:41
 */
public class CryptUtils {

    /**
     * 将输入流转为base64
     */
    public static String toBase64(InputStream inputStream) throws IOException {
        String str = null;
        byte[] bytes = new byte[inputStream.available()];
        inputStream.read(bytes);
        return Base64.encodeBase64String(bytes);
    }

}
